package com.kgc.scd.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

/**
 * @program: com.kgc.sbt.springboot03asynctimelog93.homework
 * @author: HarryXzy
 * @create: 2022-05-04 14:41
 * @description:
 **/
@Service
public class sendMailService {

    @Autowired
    private JavaMailSender javaMailSender;

    public void sendEmai(String subject,String text,String sendTo){
            SimpleMailMessage message=new SimpleMailMessage();
            message.setFrom("xuzhuoyan_xzy@163.com");
            message.setTo(sendTo);
            message.setSubject(subject);
            message.setText(text);
            //发送邮件
            javaMailSender.send(message);
        }


}
